package com.mz.mattress.admin.api.admin;

import com.mz.mattress.admin.service.MerchantGradeService;
import com.mz.mattress.api.common.Constants;
import com.mz.mattress.api.common.Result;
import com.mz.mattress.api.entity.MerchantGrade;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping(Constants.ADMIN_PATH + "merchantGrade")
public class MerchantGradeController {

    @Autowired
    private MerchantGradeService merchantGradeService;

    @GetMapping("/list")
    public Result<List<MerchantGrade>> list() {
        return merchantGradeService.list();
    }

    @GetMapping("/{id}")
    public Result<MerchantGrade> detail(@PathVariable Integer id) {
        return merchantGradeService.getById(id);
    }

    @PutMapping
    public Result update(@RequestBody MerchantGrade merchantGrade) {
        return merchantGradeService.updateById(merchantGrade);
    }

}
